home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / bytesc88.arc / FREAD.C < prev    next >
Text File  |  1987-10-04  |  896b  |  28 lines

  1. #define NOCCARGC  /* no argument count passing */
  2. #include clib.def
  3. extern int Ustatus[];
  4. /*
  5. ** Item-stream read from fd.
  6. ** Entry: buf = address of target buffer
  7. **         sz = size of items in bytes
  8. **          n = number of items to read
  9. **         fd = file descriptor
  10. ** Returns a count of the items actually read.
  11. ** Use feof() and ferror() to determine file status.
  12. */
  13. fread(buf, sz, n, fd) char *buf; int sz, n, fd; {
  14.   return (read(fd, buf, n*sz)/sz);
  15.   }
  16.  
  17. /*
  18. ** Binary-stream read from fd.
  19. ** Entry:  fd = file descriptor
  20. **        buf = address of target buffer
  21. **          n = number of bytes to read
  22. ** Returns a count of the bytes actually read.
  23. ** Use feof() and ferror() to determine file status.
  24. */
  25. read(fd, buf, n) int fd, n; char *buf; {
  26.   return(Uread(buf,fd,n));
  27.   }
  28.